package com.ghca.myinfo3.project.service.impl;

import com.ghca.myinfo3.project.entity.BidedProject;
import com.ghca.myinfo3.project.entity.Project;
import com.ghca.myinfo3.project.repository.BidProjectRepository;
import com.ghca.myinfo3.project.repository.ProjectRepository;
import com.ghca.myinfo3.project.service.IProjectService;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by gh on 2016/12/20.
 */
@Service
public class ProjectService implements IProjectService {


    @Resource
    private List<ProjectRepository> projectRepositories;


    @Override
    public Page<Project> findAll(Pageable pageable, int model) {
        for(ProjectRepository projectRepository: projectRepositories) {
            if(projectRepository.getModel() == model){
                return projectRepository.findAll(pageable);
            }
        }
        return null;
    }
}
